Programmatically edit Object Level

I need to edit an Object's Level with DXL. I tried to treat it as an attribute

myObject."Object Level" = 2


But that was a no-go. I can't find anything in the reference manual. Any ideas?


joeyvitoro - Fri Feb 24 12:32:25 EST 2012

Re: Programmatically edit Object Level
joeyvitoro - Fri Feb 24 15:38:07 EST 2012

move(childObject(below(parentObject))

Is what I was looking for.

Re: Programmatically edit Object Level
llandale - Sat Feb 25 16:13:52 EST 2012

Object Level, Object Identifier, and Object Number are psuedo-attributes; their values are derived from the Object and other information and they cannot be set directly.

Object Level can be retrieved with the "level(Object)" perm.
Object Identifier can be retrieved with the "identifier(Object)" perm
Object Number can be retrieved with the "number(Object)" perm

int iLevel = level(o)
string ObjId = identifier(o)
string ParaNum = number(o)

To change these values you must do something other than setting values. The level and the number are derived from that Object's position in the hierarchy. An object that is "below" another object will have a level one higher. The paragraph number is derived from the position and the level. You cannot change the Absolute Number part of the Identifier but you can change the module-level "Prefix" attribute, which would change the identifier of all its objects.

You adjust hierarchy by "moving" the object. You can make 3 types of moves:
top - make this object the very first object in the module
after - make this object following and at the same level as the target object
below - make this object following and at the next lower level as the target object.

Once you re-position the object, its level and number will change, as will at least some other objects as their position changes implicitely in the hierarchy.

You should practice using the GUI. Get some sandbox module, show columns Object Level and Object Number, and start clicking and dragging and dropping an object around, choosing to "move" it (don't chose making a link). You will see the values in those columns change. Once you are comfortable with that then try to DXL code it.

-Louie